#ifndef SINGLETON_H
#define SINGLETON_H

#include <cassert>
using namespace std;

template< class T >
class Singleton
{
 public:
        static T* Instance()
        {
            if( !pInstance )
                pInstance = new T;
                
            assert( pInstance != NULL );
            
            return pInstance;
        }    
      
 private:
         static T* pInstance;
         
         Singleton();
         Singleton( Singleton const& );
         Singleton& operator=( Singleton const& );
         ~Singleton(); 
};

template <class T> T* Singleton<T>::pInstance=NULL; 

#endif
